package com.xzh.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xzh.model.Users;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface UsersMapper extends BaseMapper<Users> {
    default Page<Users> selectAll(Page<Users> page, Users users){
        LambdaQueryWrapper<Users> qw = Wrappers.lambdaQuery(users);
        return selectPage(page, qw);
    }

    default Users findByUsername(String username){
        LambdaQueryWrapper<Users> qw = Wrappers.lambdaQuery();
        qw.eq(Users::getUsername, username);
        return selectOne(qw);
    }
}
